﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player_body_Animation : MonoBehaviour
{
    Animator animator;
    public Rigidbody2D rigid2d;
    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        float horizontal = (float)(Input.GetAxisRaw("Horizontal"));
        float vertical = (float)(Input.GetAxisRaw("Vertical"));
        animator.SetFloat("Horizental", horizontal);
        animator.SetFloat("Vertical", vertical);
        animator.SetFloat("Speed", Mathf.Sqrt(horizontal * horizontal + vertical * vertical));
    }
}
